//
//  FBMenuModel.m
//  FindBook
//
//  Created by zhaoxu_liu on 13-11-1.
//  Copyright (c) 2013年 lzx. All rights reserved.
//

#import "FBMenuModel.h"
#import "FBMenuData.h"

@implementation FBMenuModel

- (ASIHTTPRequest *)request
{
    NSURL* url = [NSURL URLWithString:@"http://apis.juhe.cn/goodbook/catalog?key=b2de0032cf675b92c2cb827c656d68e6"];
    RYCFormDataRequest *request = [RYCFormDataRequest requestWithURL:url];
    return request;
}

- (BOOL)handleResponseJSON:(id)aJSON
{
    if ([aJSON isKindOfClass:[NSArray class]]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *menu in aJSON) {
            FBMenuData *menuData = [[FBMenuData alloc] init];
            menuData.ID = [menu objectForKey:@"id"];
            menuData.catalog = [menu objectForKey:@"catalog"];
            [array addObject:menuData];
        }
        
        self.ewRspData.result = array;
    }
    
    return YES;
}

@end
